#include <iostream>
#include <algorithm>

using namespace std;

const int N = 3e4 + 10;
int n, w;
int a[N];

int main()
{
	cin >> w >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1);
	
	int ans = 0;
	int left = 1, right = n;
	while(left <= right)
	{
		if(a[left] + a[right] <= w)
		{
			ans++;
			left++;
			right--;	
		}
		else
		{
			ans++;
			right--;	
		}	
	} 
	
	cout << ans << endl;
	
	return 0;
}
